//
// Created by wxd on 2025/8/10.
//

#pragma once

#ifndef CUBE_H
#define CUBE_H

#include "BaseGeometry.h"
#include <vector>
#include "../glFramework/texture/Texture.h"
#include "glm/glm.hpp"
#include "../application/app/Application.h"

class Cube : public BaseGeometry {
public:
    Cube() {
        m_DrawMode = GL_TRIANGLES;
        m_GeometryType = GeometryType::TRIANGLE;
        if (EngineApp.isGLInited()) {
            BaseGeometry::initVAO();
        }
    }

    Cube(DrawType type, GLenum mode) {
        m_DrawType = type;
        m_DrawMode = mode;
        m_GeometryType = GeometryType::TRIANGLE;
        if (EngineApp.isGLInited()) {
            BaseGeometry::initVAO();
        }
    }

    Cube(float cubeWidth, glm::vec3 cubeCenter);
    Cube(float cubeWidth, glm::vec3 cubeCenter, glm::vec4 cols);

    std::unique_ptr<BaseGeometry> clone() const override {
        return std::make_unique<Cube>(*this);
    }

    glm::vec3 getCubeCenter() const;

private:
    float m_CubeWidth{};
    glm::vec3 m_CubeCenter{};
    std::vector<glm::vec3> m_CubeVertices;
    std::vector<glm::vec2> m_CubeTexCoords;
    std::vector<glm::vec3> m_CubeNormals;
    std::vector<glm::uvec3> m_CubeFaces;
    std::vector<glm::vec3> m_CubeColors;

    glm::vec3 DEFAULT_COL = glm::vec3(1.f, 0.f, 0.f);
};
#endif //CUBE_H
